package com.ms.oschina.fragment;

import android.os.Bundle;

import com.ms.oschina.R;
import com.ms.oschina.adapter.ViewPagerFragmentAdapter;
import com.ms.oschina.base.BasePagerSlidingTabFragment;
import com.ms.oschina.bean.Constants;
import com.ms.oschina.bean.EventList;
import com.ms.oschina.util.UiUtils;

public class ActivitiesFragment extends BasePagerSlidingTabFragment {
 
	private Class[] fragments = new Class[] { ActivitiesInfoFragment.class,
			ActivitiesInfoFragment.class };

	public static final int NEW_EVENT = EventList.EVENT_LIST_TYPE_NEW_EVENT;
	public static final int MY_EVENT = EventList.EVENT_LIST_TYPE_MY_EVENT;

	private int[] mark = new int[] { NEW_EVENT, MY_EVENT };

	@Override
	public void addTab(ViewPagerFragmentAdapter adapter) {
		String[] titles = UiUtils.getStringArray(R.array.events);

		for (int i = 0; i < titles.length; i++) {
			Bundle args = new Bundle();
			args.putInt(Constants.ARGS, mark[i]);
			adapter.addTab(titles[i], fragments[i], args);
		}
	}

	@Override
	public int offscreenPageLimit() {
		return 2;
	}
}
